<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MY_Controller{
	public function __construct(){
		parent::__construct();
	}
    
	public function index()
	{
	    $this->check_page_login();
	    
	    $this->load->library('pagination');
	    $limit_num = !empty($_GET['per_page']) ? intval($_GET['per_page']) : 0;

	    $this->load->model('topic_model');
		$this->p['poster_id'] = $this->loginer->id;
		$list_topic = $this->topic_model->get_follow_by_page($limit_num,$this->loginer->id);
		$loginer_id = empty($this->loginer->id) ? 0 : $this->loginer->id;
		$list_topic = $this->topic_model->list_favo_status($list_topic,$loginer_id);
		$this->_data['list_topic'] = $list_topic;
	    //分页导航
    	$this->pagination->base_url = $this->page_url($this->p);;
	    $this->pagination->total_rows = $this->topic_model->count;
	    $this->_data['pagelinks'] = $this->pagination->create_links();
	    
	    //当前导航
	    $this->_data['nav_index'] = ' c ';
	    
    	$this->load->view('index',$this->_data);		
	}
	
}

